#ifndef _COM_UTIL_H
#define _COM_UTIL_H

#ifdef __cplusplus
extern "C"{
#endif // __cplusplus

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include "com_util.h"
#include "common.h"


int ComOpen(const char* uart_dev);
int ComClose(int fd);
int ComRead(int fd,u8* buf,int len);
int ComWrite(int fd,u8* buf,int len);
BOOL ReadDevice( int fd, unsigned long uLen, u8* pData);
void ComSetSpeed(int fd, int speed);
int ComSetParity(int fd, int databits, int stopbits, int parity);
int ComInit(const char* uart_dev);
void * findComMsgData(u8 * ptrBuff, int buflen, BOOL check, int * checkLen);
int checkComData(u8 * ptrBuff, int buflen);
int writeComMsg(int comFd, int cmd, u8 * msgBuff, int msgLen);



#ifdef __cplusplus
}
#endif // __cplusplus

#endif	// _COM_UTIL_H

